package nc.files.ct.utils;

import java.util.Collection;

import nc.bs.framework.common.NCLocator;
import nc.md.model.MetaDataException;
import nc.md.persist.framework.IMDPersistenceQueryService;
import nc.ui.pub.print.IMetaDataDataSource;
import nc.vo.pubapp.pattern.model.entity.bill.AbstractBill;
import nccloud.framework.core.exception.ExceptionUtils;

public class BillPdfDataSource implements IMetaDataDataSource {

	/**
	 * 
	 */
	private static final long serialVersionUID = 6613147708180615957L;

	String billId = null;

	Class<? extends AbstractBill> aggVOClz = null;

	public String getBillId() {
		return billId;
	}

	public void setBillId(String billId) {
		this.billId = billId;
	}

	public Class<? extends AbstractBill> getAggVOClz() {
		return aggVOClz;
	}

	public void setAggVOClz(Class<? extends AbstractBill> aggVOClz) {
		this.aggVOClz = aggVOClz;
	}

	public BillPdfDataSource(String billId, Class<? extends AbstractBill> aggVOClz) {
		setBillId(billId);
		setAggVOClz(aggVOClz);
	}

	@Override
	public String[] getAllDataItemExpress() {
		return null;
	}

	@Override
	public String[] getAllDataItemNames() {
		return null;
	}

	@Override
	public String[] getDependentItemExpressByExpress(String arg0) {
		return null;
	}

	@Override
	public String[] getItemValuesByExpress(String arg0) {
		return null;
	}

	@Override
	public String getModuleName() {
		return null;
	}

	@Override
	public boolean isNumber(String arg0) {
		return false;
	}

	@Override
	public Object[] getMDObjects() {
		IMDPersistenceQueryService bs = NCLocator.getInstance().lookup(IMDPersistenceQueryService.class);
		Object[] aggvos = null;
		try {
			@SuppressWarnings("rawtypes")
			Collection tempList = bs.queryBillOfVOByPKs(aggVOClz, new String[] { getBillId() }, false);
			aggvos = tempList.toArray();
		} catch (MetaDataException e) {
			ExceptionUtils.wrapException(e);
		}
		return aggvos;
	}

}
